/*
 * Copyright (c) 2023, 2023,yzc.cn All rights reserved.
 *
 */
package cn.yzc.service.impl;

import cn.yzc.dao.OrderDao;
import cn.yzc.dao.OrderDetailsDao;
import cn.yzc.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * <p>Project: SpringPro - OrderServiceImpl</p>
 * <p>Powered by yzc On 2023-10-23 15:11:04</p>
 * <p>描述：<p>
 *
 * @author yzc [yzc0415@126.com]
 * @version 1.0
 * @since 17
 */
@Service
public class OrderServiceImpl implements OrderService {

    @Autowired
    OrderDetailsDao orderDetailsDao;

    @Autowired
    OrderDao orderDao;

    //事务管理 value = "transactionManager"事务管理bean的名称与注解属性一致，可以省略
    @Transactional(value = "transactionManager")
    @Override
    public int save() {
        String oid = "202310231541 ";
        int rs = orderDao.saveOrder(oid, "小小", "河南郑州", 1000.00, 0);

        int eiu = 10 / 0;
        rs = orderDetailsDao.saveOrderDerails(oid, "778ddd", "银苹果", 500.00, 1, 6);
        return rs;
    }
}
